package com.zlp.jwt.controller;

import com.zlp.jwt.annotation.UserLoginToken;
import com.zlp.jwt.entity.User;
import com.zlp.jwt.util.JwtUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhulaiping
 * @create: 2021-12-06 17:02
 **/
@RestController
public class JwtController {

    @GetMapping("/login")
    public String login(){
        String token = JwtUtil.getToken(new User("1","zlp","123456"));
        return token;
    }
    @UserLoginToken(required = true)
    @GetMapping("/getMessage")
    public String getMessage(){
        return "你已通过验证";
    }
}
